package com.cfpl.project_common.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.lang.NonNull;
/**
 * 肥料领取记录表
 * @TableName fertilizer_acquire_record
 */
@TableName(value ="fertilizer_acquire_record")
@Data
public class FertilizerAcquireRecord implements Serializable {
    /**
     * 主键
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 领取肥料编号
     */
    @ApiModelProperty(required = true)
    @NonNull
    private Long fertilizerId;

    /**
     * 领取数量
     */
    @ApiModelProperty(required = true)
    @NonNull
    private Integer acquireQuantity;

    /**
     * 领取时间
     */
    private Date acquireDate;

    /**
     * 领取人
     */
    private Long adminId;

    /**
     * 使用数量
     */
    @ApiModelProperty(required = true)
//    @NonNull
    private Integer fertilizerUsage;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        FertilizerAcquireRecord other = (FertilizerAcquireRecord) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getFertilizerId() == null ? other.getFertilizerId() == null : this.getFertilizerId().equals(other.getFertilizerId()))
            && (this.getAcquireDate() == null ? other.getAcquireDate() == null : this.getAcquireDate().equals(other.getAcquireDate()))
            && (this.getAdminId() == null ? other.getAdminId() == null : this.getAdminId().equals(other.getAdminId()))
            && (this.getFertilizerUsage() == null ? other.getFertilizerUsage() == null : this.getFertilizerUsage().equals(other.getFertilizerUsage()))
            && (this.getAcquireQuantity() == null ? other.getAcquireQuantity() == null : this.getAcquireQuantity().equals(other.getAcquireQuantity()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getFertilizerId() == null) ? 0 : getFertilizerId().hashCode());
        result = prime * result + ((getAcquireDate() == null) ? 0 : getAcquireDate().hashCode());
        result = prime * result + ((getAdminId() == null) ? 0 : getAdminId().hashCode());
        result = prime * result + ((getFertilizerUsage() == null) ? 0 : getFertilizerUsage().hashCode());
        result = prime * result + ((getAcquireQuantity() == null) ? 0 : getAcquireQuantity().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", fertilizerId=").append(fertilizerId);
        sb.append(", acquireDate=").append(acquireDate);
        sb.append(", adminId=").append(adminId);
        sb.append(", fertilizerUsage=").append(fertilizerUsage);
        sb.append(", acquireQuantity=").append(acquireQuantity);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}